<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<style>
   div{
       width: 100px;
       height: 50px;
       border: 2px red solid;
       /*display: inline;*/  /* 导致宽度失效 */
       display: inline-block;
   }
   span{
       width: 100px;
       height: 50px;
       border: 2px orange solid;
       display: inline-block; /* 将行内元素转换为块级元素 */
   }
</style>

<body>
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <div>4</div>

    <span>5</span>
    <span>6</span>
    <span>7</span>
</body>
</html>